<%@ page 
	language="java" 
	contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
%>
<link href="<%=request.getContextPath()%>/style/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/script/default.js"></script>
<script type="text/javascript">
//<![CDATA[
  	window.GJS=new ControllerJSObj(jQuery,'<%=request.getContextPath()%>');
  	window.HJS={
		login:function(){
			GJS.forward("/page/login.jsp");
		},
		logout:function(){
			if(window.confirm("确定退出?")){
				GJS.logout("/pages/logouAction.jsp");
			}
		},
		register:function(){
			GJS.forward("/page/register.jsp");
		},
		profile:function(){
			GJS.forward("/pages/info.jsp");
		},
		loggedIn:"<%=session.getAttribute(com.cdshop.web.SessionAttribute.IDENTITY)!=null%>",
		shoppingCart:function(){
			if(HJS.loggedIn=="true"){
				GJS.popup("/pages/shoppingCart.jsp",800,600);
			}else{
				if(window.confirm("登录才能使用购物车!需要登录吗?")){
					GJS.forward("/page/login.jsp");
				}
			}
		},
		order:function(data){
			if(HJS.loggedIn=="true"){
				GJS.order("/pages/orderAction.jsp","商品放入购物车!","提交失败!请重试",data);
			}else{
				if(window.confirm("登录才能购买商品!现在登录吗?")){
					GJS.forward("/page/login.jsp");
				}
			}
		},
		retreat:function(data){
			if(HJS.loggedIn=="true"){
				if(window.confirm("真的不要了?")){
					GJS.retreat("/pages/retreatAction.jsp","商品移出购物车!","提交失败!请重试",data);
				}
			}else{
				window.alert("你已经退出了!");
				window.close();
			}
		},
		list:function(){
			GJS.forward("/page/list.jsp");
		}
  	};
//]]>
</script>
